﻿using FS.Common.DotNetBean;
using FS.Common.DotNetCode;
using FS.Common.DotNetUI;
using FS.Business;
using System;
using System.Collections;
using System.Data;

namespace FS.Web.BLL.Visa_info
{
    public partial class Visa_InfoFinanceForm : PageBase
    {
        private string _key;
        private visa_dao _visa = new visa_dao();
        protected void Page_Load(object sender, EventArgs e)
        {
            this._key = base.Request["key"];
            if (!base.IsPostBack)
            {
                if (!string.IsNullOrEmpty(this._key))
                {
                    this.InitData();
                    this.GetSelect_moneyflag();
                    this.GetSelect_moneytype();
                }
            }
        }

        private void InitData()
        {
            string ls_cus = _visa.GetVisaDetailForm(this._key);
            this.customer.Value = ls_cus;
        }

        //寄件类型
        private void GetSelect_moneyflag()
        {
            DataTable dt = _visa.GetSelect_moneyflag();
            ControlBindHelper.BindHtmlSelect(dt, this.Ref_moneyflag, "property_value", "property_key", "");
        }
        private void GetSelect_moneytype()
        {
            DataTable dt = _visa.GetSelect_moneytype();
            ControlBindHelper.BindHtmlSelect(dt, this.Ref_moneytype, "property_value", "property_key", "");
        }
        protected void Save_Click(object sender, EventArgs e)
        {
            string ls_userid = RequestSession.GetSessionUser().UserId.ToString();
            string ls_username = RequestSession.GetSessionUser().UserName.ToString();

            string[] ls_detailid = this._key.Split(',');
            string ls_moneyflag = this.Ref_moneyflag.Value.Trim();
            string ls_moneytype = this.Ref_moneytype.Value;
            string ls_account = this.InfoDetail_Account.Value.Trim();

            bool IsOk = _visa.UpdateInfoFinanceForm(ls_detailid, ls_moneyflag, ls_moneytype, ls_account, ls_userid, ls_username);
            if (IsOk)
            {
                ShowMsgHelper.AlertMsg("操作成功！");
            }
            else
            {
                ShowMsgHelper.Alert_Error("操作失败！");
            }
        }
    }
}